namespace FIREFLYX {
    /** 鼠标管理器 */
    export class MouseManager {
        public static instance: MouseManager = new MouseManager();

        public init(list: [string, () => any][]) {
            list.push(["mousedown", this._mouseDown.bind(this)]);
            list.push(["mouseup", this._mouseUp.bind(this)]);
            list.push(["mousemove", this._mouseMove.bind(this)]);
            list.push(["mousewheel", this._mouseWheel.bind(this)]);
            list.push(["DOMMouseScroll", this._mouseWheel.bind(this)]);
        }

        private _mouseDown(e: MouseEvent) {
            GlobalEventManager.Instance.dispatchEvent("mousedown", e);
        }
        private _mouseUp(e: MouseEvent) {
            GlobalEventManager.Instance.dispatchEvent("mouseup", e);
        }
        private _mouseMove(e: MouseEvent) {
            GlobalEventManager.Instance.dispatchEvent("mousemove", e);
        }
        private _mouseWheel(e: WheelEvent) {
            GlobalEventManager.Instance.dispatchEvent("mousewheel", e);
        }
    }
}
